package com.rub.android.ui.activity

import android.os.Parcelable
import com.rub.android.R
import com.rub.android.base.BaseActivity
import com.rub.android.jetpack.model.ParcelUser
import kotlinx.android.synthetic.main.activity_intent.*

class IntentActivity : BaseActivity() {



    override fun initView() {

        val parcelUser = this.intent.getParcelableExtra<Parcelable>("parcelUser") as ParcelUser?

        //parcelUser?.userName为空给默认值
        user_name.text = parcelUser?.userName ?: "unknown"
        age.text = (parcelUser?.age ?: "").toString()

    }

    override fun getLayoutId(): Int = R.layout.activity_intent
}